import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/notice_v2_list_entity.dart';

NoticeV2ListEntity $NoticeV2ListEntityFromJson(Map<String, dynamic> json) {
  final NoticeV2ListEntity noticeV2ListEntity = NoticeV2ListEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    noticeV2ListEntity.total = total;
  }
  final int? quota = jsonConvert.convert<int>(json['quota']);
  if (quota != null) {
    noticeV2ListEntity.quota = quota;
  }
  final List<NoticeV2Data>? data = (json['data'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<NoticeV2Data>(e) as NoticeV2Data).toList();
  if (data != null) {
    noticeV2ListEntity.data = data;
  }
  return noticeV2ListEntity;
}

Map<String, dynamic> $NoticeV2ListEntityToJson(NoticeV2ListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['quota'] = entity.quota;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  return data;
}

extension NoticeV2ListEntityExtension on NoticeV2ListEntity {
  NoticeV2ListEntity copyWith({
    int? total,
    int? quota,
    List<NoticeV2Data>? data,
  }) {
    return NoticeV2ListEntity()
      ..total = total ?? this.total
      ..quota = quota ?? this.quota
      ..data = data ?? this.data;
  }
}

NoticeV2Data $NoticeV2DataFromJson(Map<String, dynamic> json) {
  final NoticeV2Data noticeV2Data = NoticeV2Data();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    noticeV2Data.id = id;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    noticeV2Data.title = title;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    noticeV2Data.name = name;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    noticeV2Data.content = content;
  }
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    noticeV2Data.createdAt = createdAt;
  }
  final int? updatedAt = jsonConvert.convert<int>(json['updatedAt']);
  if (updatedAt != null) {
    noticeV2Data.updatedAt = updatedAt;
  }
  final String? subjectAmount = jsonConvert.convert<String>(
      json['subjectAmount']);
  if (subjectAmount != null) {
    noticeV2Data.subjectAmount = subjectAmount;
  }
  final String? servicePrice = jsonConvert.convert<String>(
      json['servicePrice']);
  if (servicePrice != null) {
    noticeV2Data.servicePrice = servicePrice;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    noticeV2Data.status = status;
  }
  final String? catalog = jsonConvert.convert<String>(json['catalog']);
  if (catalog != null) {
    noticeV2Data.catalog = catalog;
  }
  final int? cooperRatio = jsonConvert.convert<int>(json['cooperRatio']);
  if (cooperRatio != null) {
    noticeV2Data.cooperRatio = cooperRatio;
  }
  final String? receiveName = jsonConvert.convert<String>(json['receiveName']);
  if (receiveName != null) {
    noticeV2Data.receiveName = receiveName;
  }
  final String? receiveUid = jsonConvert.convert<String>(json['receiveUid']);
  if (receiveUid != null) {
    noticeV2Data.receiveUid = receiveUid;
  }
  final int? receiveTime = jsonConvert.convert<int>(json['receiveTime']);
  if (receiveTime != null) {
    noticeV2Data.receiveTime = receiveTime;
  }
  final String? caseId = jsonConvert.convert<String>(json['caseId']);
  if (caseId != null) {
    noticeV2Data.caseId = caseId;
  }
  final String? caseName = jsonConvert.convert<String>(json['caseName']);
  if (caseName != null) {
    noticeV2Data.caseName = caseName;
  }
  final int? shareType = jsonConvert.convert<int>(json['shareType']);
  if (shareType != null) {
    noticeV2Data.shareType = shareType;
  }
  final List<NoticeV2ListDataAttaches>? attaches = (json['attaches'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<NoticeV2ListDataAttaches>(
          e) as NoticeV2ListDataAttaches).toList();
  if (attaches != null) {
    noticeV2Data.attaches = attaches;
  }
  final bool? isRead = jsonConvert.convert<bool>(json['isRead']);
  if (isRead != null) {
    noticeV2Data.isRead = isRead;
  }
  return noticeV2Data;
}

Map<String, dynamic> $NoticeV2DataToJson(NoticeV2Data entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['title'] = entity.title;
  data['name'] = entity.name;
  data['content'] = entity.content;
  data['createdAt'] = entity.createdAt;
  data['updatedAt'] = entity.updatedAt;
  data['subjectAmount'] = entity.subjectAmount;
  data['servicePrice'] = entity.servicePrice;
  data['status'] = entity.status;
  data['catalog'] = entity.catalog;
  data['cooperRatio'] = entity.cooperRatio;
  data['receiveName'] = entity.receiveName;
  data['receiveUid'] = entity.receiveUid;
  data['receiveTime'] = entity.receiveTime;
  data['caseId'] = entity.caseId;
  data['caseName'] = entity.caseName;
  data['shareType'] = entity.shareType;
  data['attaches'] = entity.attaches?.map((v) => v.toJson()).toList();
  data['isRead'] = entity.isRead;
  return data;
}

extension NoticeV2DataExtension on NoticeV2Data {
  NoticeV2Data copyWith({
    int? id,
    String? title,
    String? name,
    String? content,
    int? createdAt,
    int? updatedAt,
    String? subjectAmount,
    String? servicePrice,
    int? status,
    String? catalog,
    int? cooperRatio,
    String? receiveName,
    String? receiveUid,
    int? receiveTime,
    String? caseId,
    String? caseName,
    int? shareType,
    List<NoticeV2ListDataAttaches>? attaches,
    bool? isRead,
  }) {
    return NoticeV2Data()
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..name = name ?? this.name
      ..content = content ?? this.content
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..subjectAmount = subjectAmount ?? this.subjectAmount
      ..servicePrice = servicePrice ?? this.servicePrice
      ..status = status ?? this.status
      ..catalog = catalog ?? this.catalog
      ..cooperRatio = cooperRatio ?? this.cooperRatio
      ..receiveName = receiveName ?? this.receiveName
      ..receiveUid = receiveUid ?? this.receiveUid
      ..receiveTime = receiveTime ?? this.receiveTime
      ..caseId = caseId ?? this.caseId
      ..caseName = caseName ?? this.caseName
      ..shareType = shareType ?? this.shareType
      ..attaches = attaches ?? this.attaches
      ..isRead = isRead ?? this.isRead;
  }
}

NoticeV2ListDataAttaches $NoticeV2ListDataAttachesFromJson(
    Map<String, dynamic> json) {
  final NoticeV2ListDataAttaches noticeV2ListDataAttaches = NoticeV2ListDataAttaches();
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    noticeV2ListDataAttaches.name = name;
  }
  final String? url = jsonConvert.convert<String>(json['url']);
  if (url != null) {
    noticeV2ListDataAttaches.url = url;
  }
  return noticeV2ListDataAttaches;
}

Map<String, dynamic> $NoticeV2ListDataAttachesToJson(
    NoticeV2ListDataAttaches entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['name'] = entity.name;
  data['url'] = entity.url;
  return data;
}

extension NoticeV2ListDataAttachesExtension on NoticeV2ListDataAttaches {
  NoticeV2ListDataAttaches copyWith({
    String? name,
    String? url,
  }) {
    return NoticeV2ListDataAttaches()
      ..name = name ?? this.name
      ..url = url ?? this.url;
  }
}